package com.atguigu.acyjl;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

import com.atguigu.acyjl.activity.PrimaryPage;


public class Win extends AppCompatActivity {
    Settings settings = new Settings();
    Button winBtnPrimary,winBtnMarket,winBtnNext,btnAnswers;
    TextView scoresWin;
    static boolean winFlag = false;
    public static Win win;//传递给非activity的类使用  救命
    public static Context mContext;//传递给非activity的类使用
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_win);


        winBtnPrimary = findViewById(R.id.winBtnPrimary);
        winBtnMarket = findViewById(R.id.winBtnMarket);
        winBtnNext = findViewById(R.id.winBtnNext);
        btnAnswers = findViewById(R.id.btnAnswers);
        scoresWin = findViewById(R.id.scoresWin);

        win = this;//传递给非activity的类使用
        mContext = this.getBaseContext();//传递给非activity的类使用

       scoresWin.setText(settings.score);
       winFlag = true;
//        SharedPreferences.Editor editor = shp.edit();
//        editor.putString("textScores",scoresWin.getText().toString());
//        editor.commit();

        winBtnPrimary.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(Win.this, PrimaryPage.class);
                startActivity(i);
            }
        });
        winBtnMarket.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(Win.this,Market.class);
                startActivity(i);
            }
        });
        winBtnNext.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent i = new Intent(Win.this,PrimaryPage.class);//待下一关开发
                startActivity(i);
            }
        });
    }

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        Intent intent = new Intent(Win.this,PrimaryPage.class);
        startActivity(intent);
    }
}
